use core::ops::Deref;

use stm32f1::stm32f103::{usart1, usart2, usart3, uart4, uart5, USART1, USART2, USART3, UART4 as U4, UART5 as U5};

pub struct UART1;
pub struct UART2;
pub struct UART3;
pub struct UART4;
pub struct UART5;

impl Deref for UART1 {
    type Target = usart1::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*USART1::PTR }
    }
}

impl Deref for UART2 {
    type Target = usart2::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*USART2::PTR }
    }
}

impl Deref for UART3 {
    type Target = usart3::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*USART3::PTR }
    }
}

impl Deref for UART4 {
    type Target = uart4::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*U4::PTR }
    }
}

impl Deref for UART5 {
    type Target = uart5::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*U5::PTR }
    }
}

